#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main(int argc, char const *argv[])
{
        int n = 5;
        int i = 0;
        pid_t pid;

        for (i = 0; i < n; i++){
                pid = fork();
                if(pid == 0){
                        printf("I am child, pid = %d, ppid=%d\n", getpid(), getppid());
                        break;
                }else if(pid > 0){
                        printf("I am father, pid = %d, ppid=%d\n", getpid(), getppid());
                }
        }
        while (1){
                sleep(1);
        }
        
        return 0;
}
